import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    count: 0
  },
  getters: {
    mul(state) {
      return state.count * 2
    }
  },
  mutations: {
    jiaM(state, value) {
      console.log(value)
      state.count += value
    },
    jianM(state, value) {
      state.count -= value
    }
  },
  actions: {
    //上下文 content
    jiaA(content, value) {
      // console.log(value)
      content.commit('jiaM', value)
    },
    jianA(content, value) {
      content.commit('jianM', value)
    }
  },
  modules: {}
})
